﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Manager_AddNewCategory : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            string CategoryName = txtCategory.Text;
            string Description = txtDescription.Text;

            Category cat = new Category();
            cat.CategoryName = CategoryName;
            cat.Description = Description;

            CategoryDAL insert = new CategoryDAL();
            if(insert.Insert(cat))
                Session.Add("Message", "Insert category successfully");
            else
                Session.Add("Message", "<font color='red'>Error : Insert category unsuccess</font>");

            Response.Redirect("ManagerCategory.aspx");
        }
    }
}